import { zodToJsonSchema } from "zod-to-json-schema";
import * as schemas from './schemas/index.js';

export const toolDefinitions = [
    {
        name: "dropbox_list_folder",
        title: "Folder Listing",
        description: "Lists the contents of a folder",
        inputSchema: zodToJsonSchema(schemas.ListFolderSchema),
        annotations: { category: "DROPBOX_FOLDER", readOnlyHint: true },
    },
    {
        name: "dropbox_list_folder_continue",
        title: "Continue Folder Listing",
        description: "Continues listing folder contents using a cursor from previous list_folder operation",
        inputSchema: zodToJsonSchema(schemas.ListFolderContinueSchema),
        annotations: { category: "DROPBOX_FOLDER", readOnlyHint: true },
    },
    {
        name: "dropbox_create_folder",
        title: "Create New Folder",
        description: "Creates a new folder",
        inputSchema: zodToJsonSchema(schemas.CreateFolderSchema),
        annotations: { category: "DROPBOX_FOLDER" },
    },
    {
        name: "dropbox_delete_file",
        title: "Delete File or Folder",
        description: "Deletes a file or folder",
        inputSchema: zodToJsonSchema(schemas.DeleteFileSchema),
        annotations: { category: "DROPBOX_FILES" },
    },
    {
        name: "dropbox_move_file",
        title: "Move or Rename",
        description: "Moves or renames a file or folder",
        inputSchema: zodToJsonSchema(schemas.MoveFileSchema),
        annotations: { category: "DROPBOX_FILES" },
    },
    {
        name: "dropbox_copy_file",
        title: "Copy File or Folder",
        description: "Creates a copy of a file or folder",
        inputSchema: zodToJsonSchema(schemas.CopyFileSchema),
        annotations: { category: "DROPBOX_FILES" },
    },
    {
        name: "dropbox_search_files",
        title: "Search Files",
        description: "Searches for files and folders",
        inputSchema: zodToJsonSchema(schemas.SearchFilesSchema),
        annotations: { category: "DROPBOX_FILES", readOnlyHint: true },
    },
    {
        name: "dropbox_search_files_continue",
        title: "Continue File Search",
        description: "Continues searching files using a cursor from previous search_files operation",
        inputSchema: zodToJsonSchema(schemas.SearchFilesContinueSchema),
        annotations: { category: "DROPBOX_FILES", readOnlyHint: true },
    },
    {
        name: "dropbox_get_file_info",
        title: "Get File Info",
        description: "Gets metadata information about a file or folder",
        inputSchema: zodToJsonSchema(schemas.GetFileInfoSchema),
        annotations: { category: "DROPBOX_FILES", readOnlyHint: true },
    },
    {
        name: "dropbox_share_file",
        title: "Create Shared Link",
        description: "Creates a shared link for a file or folder. Advanced settings (password protection, expiration dates) require paid Dropbox accounts (Plus/Professional) or team membership. Basic accounts can only use 'public' visibility. If unsure about account capabilities, use 'get_current_account' first to check account type before setting advanced options.",
        inputSchema: zodToJsonSchema(schemas.ShareFileSchema),
        annotations: { category: "DROPBOX_FILES" },
    },
    {
        name: "dropbox_get_shared_links",
        title: "List Shared Links",
        description: "Lists shared links for files and folders",
        inputSchema: zodToJsonSchema(schemas.GetSharedLinksSchema),
        annotations: { category: "DROPBOX_LINKS", readOnlyHint: true },
    },
    {
        name: "dropbox_upload_file",
        title: "Upload File",
        description: "Uploads a local file to Dropbox using file:// URI. Reads the file directly from the local filesystem and uploads it as binary data.",
        inputSchema: zodToJsonSchema(schemas.UploadFileSchema),
        annotations: { category: "DROPBOX_FILES" },
    },
    {
        name: "dropbox_download_file",
        title: "Download File",
        description: "Downloads a file from Dropbox",
        inputSchema: zodToJsonSchema(schemas.DownloadFileSchema),
        annotations: { category: "DROPBOX_FILES", readOnlyHint: true },
    },
    {
        name: "dropbox_list_revisions",
        title: "List File Revisions",
        description: "Lists the revisions of a file",
        inputSchema: zodToJsonSchema(schemas.ListRevisionsSchema),
        annotations: { category: "DROPBOX_METADATA", readOnlyHint: true },
    },
    {
        name: "dropbox_restore_file",
        title: "Restore File Version",
        description: "Restores a file to a previous revision",
        inputSchema: zodToJsonSchema(schemas.RestoreFileSchema),
        annotations: { category: "DROPBOX_FILES" },
    },
    {
        name: "dropbox_get_current_account",
        title: "Get Account Info",
        description: "Gets information about the current account. Returns account details including display name, email, and account ID in the format: 'Account: {display_name}\\nEmail: {email}\\nAccount ID: {account_id}'",
        inputSchema: zodToJsonSchema(schemas.GetCurrentAccountSchema),
        annotations: { category: "DROPBOX_ACCOUNT", readOnlyHint: true },
    },
    {
        name: "dropbox_get_space_usage",
        title: "Get Storage Usage",
        description: "Gets the current space usage information. Returns storage usage details including used bytes and allocated space in the format: 'Used: {used_bytes} bytes\\nAllocated: {allocated_bytes} bytes' for individual accounts, or 'Used: {used_bytes} bytes\\nAllocation Type: {type}' for other account types",
        inputSchema: zodToJsonSchema(schemas.GetSpaceUsageSchema),
        annotations: { category: "DROPBOX_ACCOUNT", readOnlyHint: true },
    },
    {
        name: "dropbox_get_temporary_link",
        title: "Get Temporary Link",
        description: "Gets a temporary link to a file",
        inputSchema: zodToJsonSchema(schemas.GetTemporaryLinkSchema),
        annotations: { category: "DROPBOX_LINKS", readOnlyHint: true },
    },
    {
        name: "dropbox_add_file_member",
        title: "Add File Member",
        description: "Adds a member to a file",
        inputSchema: zodToJsonSchema(schemas.AddFileMemberSchema),
        annotations: { category: "DROPBOX_FILES" },
    },
    {
        name: "dropbox_list_file_members",
        title: "List File Members",
        description: "Lists the members of a file",
        inputSchema: zodToJsonSchema(schemas.ListFileMembersSchema),
        annotations: { category: "DROPBOX_FILES", readOnlyHint: true },
    },
    {
        name: "dropbox_remove_file_member",
        title: "Remove File Member",
        description: "Removes a member from a file",
        inputSchema: zodToJsonSchema(schemas.RemoveFileMemberSchema),
        annotations: { category: "DROPBOX_FILES" },
    },
    {
        name: "dropbox_share_folder",
        title: "Share Folder",
        description: "Shares a folder",
        inputSchema: zodToJsonSchema(schemas.ShareFolderSchema),
        annotations: { category: "DROPBOX_FOLDER" },
    },
    {
        name: "dropbox_list_folder_members",
        title: "List Folder Members",
        description: "Lists the members of a shared folder",
        inputSchema: zodToJsonSchema(schemas.ListFolderMembersSchema),
        annotations: { category: "DROPBOX_FOLDER", readOnlyHint: true },
    },
    {
        name: "dropbox_add_folder_member",
        title: "Add Folder Member",
        description: "Adds a member to a shared folder",
        inputSchema: zodToJsonSchema(schemas.AddFolderMemberSchema),
        annotations: { category: "DROPBOX_FOLDER" },
    },
    {
        name: "dropbox_list_shared_folders",
        title: "List Shared Folders",
        description: "Lists all shared folders that the current user has access to",
        inputSchema: zodToJsonSchema(schemas.ListSharedFoldersSchema),
        annotations: { category: "DROPBOX_FOLDER", readOnlyHint: true },
    },
    {
        name: "dropbox_unshare_file",
        title: "Unshare File",
        description: "Remove all members from this file. Does not remove inherited members.",
        inputSchema: zodToJsonSchema(schemas.UnshareFileSchema),
        annotations: { category: "DROPBOX_FILES" },
    },
    {
        name: "dropbox_unshare_folder", 
        title: "Unshare Folder",
        description: "Allows a shared folder owner to unshare the folder. You'll need to call check_job_status to determine if the action has completed successfully.",
        inputSchema: zodToJsonSchema(schemas.UnshareFolderSchema),
        annotations: { category: "DROPBOX_FOLDER" },
    },
    {
        name: "dropbox_create_file_request",
        title: "Create File Request",
        description: "Creates a file request",
        inputSchema: zodToJsonSchema(schemas.CreateFileRequestSchema),
        annotations: { category: "DROPBOX_FILE_REQUEST" },
    },
    {
        name: "dropbox_get_file_request",
        title: "Get File Request",
        description: "Gets a file request by ID",
        inputSchema: zodToJsonSchema(schemas.GetFileRequestSchema),
        annotations: { category: "DROPBOX_FILE_REQUEST", readOnlyHint: true },
    },
    {
        name: "dropbox_list_file_requests",
        title: "List File Requests",
        description: "Lists all file requests",
        inputSchema: zodToJsonSchema(schemas.ListFileRequestsSchema),
        annotations: { category: "DROPBOX_FILE_REQUEST", readOnlyHint: true },
    },
    {
        name: "dropbox_delete_file_request",
        title: "Delete File Request",
        description: "Deletes file requests",
        inputSchema: zodToJsonSchema(schemas.DeleteFileRequestSchema),
        annotations: { category: "DROPBOX_FILE_REQUEST" },
    },
    {
        name: "dropbox_update_file_request",
        title: "Update File Request",
        description: "Updates a file request (title, destination, description, open/close status)",
        inputSchema: zodToJsonSchema(schemas.UpdateFileRequestSchema),
        annotations: { category: "DROPBOX_FILE_REQUEST" },
    },
    {
        name: "dropbox_batch_delete",
        title: "Batch Delete Files",
        description: "Deletes multiple files and folders in a single operation. This is an efficient way to delete many items at once. NOTE: This may be an async operation that returns a job ID for status checking. Each entry only needs a 'path' field.",
        inputSchema: zodToJsonSchema(schemas.BatchDeleteSchema),
        annotations: { category: "DROPBOX_FILES" },
    },
    {
        name: "dropbox_batch_move",
        title: "Batch Move Files",
        description: "Moves or renames multiple files and folders in a single operation. This is an efficient way to move many items at once. NOTE: This may be an async operation that returns a job ID for status checking. Each entry needs 'from_path' and 'to_path' fields. Optional top-level 'autorename' and 'allow_ownership_transfer' apply to all entries.",
        inputSchema: zodToJsonSchema(schemas.BatchMoveSchema),
        annotations: { category: "DROPBOX_FILES" },
    },
    {
        name: "dropbox_batch_copy",
        title: "Batch Copy Files",
        description: "Copies multiple files and folders in a single operation. This is an efficient way to copy many items at once. NOTE: This may be an async operation that returns a job ID for status checking. Each entry needs 'from_path' and 'to_path' fields. Optional top-level 'autorename' applies to all entries.",
        inputSchema: zodToJsonSchema(schemas.BatchCopySchema),
        annotations: { category: "DROPBOX_FILES" },
    },
    {
        name: "dropbox_check_batch_job_status",
        title: "Check Batch Job Status",
        description: "Checks the status of a batch operation using the async job ID returned from batch operations. Use this to monitor progress and get final results of batch_copy, batch_move, or batch_delete operations. The tool automatically detects the operation type.",
        inputSchema: zodToJsonSchema(schemas.BatchJobStatusSchema),
        annotations: { category: "DROPBOX_METADATA", readOnlyHint: true },
    },
    {
        name: "dropbox_get_thumbnail",
        title: "Get File Thumbnail",
        description: "Gets a thumbnail image for a file and returns it as binary image data with proper MIME type. The response contains the actual image that can be displayed directly by compatible clients.",
        inputSchema: zodToJsonSchema(schemas.GetThumbnailSchema),
        annotations: { category: "DROPBOX_METADATA", readOnlyHint: true },
    },
    {
        name: "dropbox_save_url",
        title: "Save URL to Dropbox",
        description: "Downloads content from a URL and saves it as a file in Dropbox. This is useful for saving web content, images, documents, etc. directly from URLs.",
        inputSchema: zodToJsonSchema(schemas.SaveUrlSchema),
        annotations: { category: "DROPBOX_LINKS" },
    },
    {
        name: "dropbox_save_url_check_job_status",
        title: "Check URL Save Status",
        description: "Checks the status of a save URL operation using the async job ID. Use this to monitor the progress of URL downloads.",
        inputSchema: zodToJsonSchema(schemas.SaveUrlCheckJobStatusSchema),
        annotations: { category: "DROPBOX_METADATA", readOnlyHint: true },
    },
    {
        name: "dropbox_lock_file_batch",
        title: "Lock Files (Batch)",
        description: "Temporarily locks files to prevent them from being edited by others. This is useful during collaborative work to avoid editing conflicts. NOTE: This may be an async operation that returns a job ID for status checking.",
        inputSchema: zodToJsonSchema(schemas.LockFileBatchSchema),
        annotations: { category: "DROPBOX_FILES" },
    },
    {
        name: "dropbox_unlock_file_batch",
        title: "Unlock Files (Batch)",
        description: "Unlocks previously locked files, allowing others to edit them again. NOTE: This may be an async operation that returns a job ID for status checking.",
        inputSchema: zodToJsonSchema(schemas.UnlockFileBatchSchema),
        annotations: { category: "DROPBOX_FILES" },
    },
    {
        name: "dropbox_list_received_files",
        title: "List Received Files",
        description: "Lists files that have been shared with the current user by others",
        inputSchema: zodToJsonSchema(schemas.ListReceivedFilesSchema),
        annotations: { category: "DROPBOX_FILES", readOnlyHint: true },
    },
    {
        name: "dropbox_check_job_status",
        title: "Check Job Status",
        description: "Checks the status of an asynchronous operation (like unshare_folder, share_folder, etc.)",
        inputSchema: zodToJsonSchema(schemas.CheckJobStatusSchema),
        annotations: { category: "DROPBOX_METADATA", readOnlyHint: true },
    },
    {
        name: "dropbox_remove_folder_member",
        title: "Remove Folder Member",
        description: "Removes a member from a shared folder.",
        inputSchema: zodToJsonSchema(schemas.RemoveFolderMemberSchema),
        annotations: { category: "DROPBOX_FOLDER" },
    },
];
